import Vue from 'vue'

//1.导入并绑定Vuex
import Vuex from 'vuex'
Vue.use(Vuex)

//2.定义数据存储仓库state
const state = {
    account: ''
}

//3.定义用于修改数据的方法
const mutations = {
    setsername: (state, account) => {
        state.account = account
        localStorage.setItem('account', account)
    }
}

//4.异步修改数据
const actions = {}

/* //5.计算属性
const getters = {
    account: (state) => localStorage.getItem('account')
} */

//6.导出store实例
export default new Vuex.Store({
    state,
    // getters,
    actions,
    mutations
})
